import javax.swing.tree.TreeNode;
public TreeNode left;

class Solution {
    public boolean isSymmetric(TreeNode root) {
        if(root==null){
            return true;
        }
        return dfs(root.right,root.left);
    }
    boolean dfs(TreeNode left,TreeNode right){
        if(left==null&&right==null){
            return true;
        }
        if(left==null||right==null){
            return false;
        }
        return dfs(left.left,right.right)&&dfs(left.right,right.left);
    }
}